package com.byzk.p2p.front.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.byzk.p2p.admin.base.util.PageInfo;
import com.byzk.p2p.front.dao.UserExperienceGoldDao;
import com.byzk.p2p.front.dto.ExperienceGold;

@Service
public class ExperienceGoldService {
	
	@Autowired
	private UserExperienceGoldDao userExperienceGoldDao;
	
	public PageInfo<ExperienceGold> list(ExperienceGold experienceGold){
		PageInfo<ExperienceGold> info = new PageInfo<ExperienceGold>();
		info.setPageList(userExperienceGoldDao.list(experienceGold));
		return info;
	}
	
	public int count(ExperienceGold experienceGold){
		return userExperienceGoldDao.count(experienceGold);
	}

	public ExperienceGold goldGetByUserId(Integer id){
		ExperienceGold experienceGold = new ExperienceGold();
		experienceGold.setUserId(id);
		experienceGold.setStatus("notUsed");
		return userExperienceGoldDao.goldGetByUserId(experienceGold);
	}
	
	public int save(ExperienceGold experienceGold){
		return userExperienceGoldDao.insert(experienceGold);
	}
	
	public ExperienceGold goldGetCode(ExperienceGold experienceGold){
		return userExperienceGoldDao.goldGetByUserId(experienceGold);
	}
}
